use khies_edcc_replication, clear
global controls age_head i.educ numcar married male ownhouse



******************************************************************************************************************************
******************************************************** Main Results ********************************************************
******************************************************************************************************************************



******************************************
******* Table 1, columns (1) to (4) ******
******************************************

** please use "Results using KLIPS" to replicate results from columns (5) and (6)


** panel A
preserve
keep if year>=2006
xi: reg boap_cpi treat_post i.year i.eldest $controls [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg coresi treat_post i.year i.eldest  $controls [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest  $controls [pw=weight], r
restore


** panel B
preserve
keep if year>=2006
xi: reg boap_cpi treat_post i.year i.eldest [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest [pw=weight], r
xi: reg coresi treat_post i.year i.eldest [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest [pw=weight], r
restore


** panel C
preserve
keep if year>=2006
xi: reg boap_cpi treat_post i.year i.eldest treat_year $controls [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest treat_year $controls [pw=weight], r
xi: reg coresi treat_post i.year i.eldest treat_year $controls [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest treat_year $controls [pw=weight], r
restore

* mean of dependent variables
table treat [pw=weight] if year>=2006 & post==0 & treat==1, c(mean boap_cpi mean priv_trans_cpi mean coresi mean live_grandchild)




** panel D
preserve
keep if year>=2006
keep if eldest>=55 & eldest<=74
xi: reg boap_cpi treat_post i.year i.eldest $controls [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg coresi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest $controls [pw=weight], r
restore

* mean of dependent variables
table treat [pw=weight] if year>=2006 & post==0 & treat==1 & eldest<=74, c(mean boap_cpi mean priv_trans_cpi mean coresi mean live_grandchild)




** panel E
preserve
keep if year>=2006
keep if eldest>=64 & eldest<=65
xi: reg boap_cpi treat_post i.year i.eldest $controls [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg coresi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest $controls [pw=weight], r
restore

*mean of dependent variables 
table treat [pw=weight] if year>=2006 & post==0 & treat==1 & eldest==65, c(mean boap_cpi mean priv_trans_cpi mean coresi mean live_grandchild)




** panel F
xi: reg boap_cpi treat_post i.year i.eldest $controls [pw=weight], r 
xi: reg priv_trans_cpi treat_post i.year i.eldest $controls [pw=weight], r
xi: reg coresi treat_post i.year i.eldest  $controls [pw=weight], r
xi: reg live_grandchild treat_post i.year i.eldest  $controls [pw=weight], r

* mean of dependent variables 
table treat [pw=weight] if post==0 & treat==1, c(mean boap_cpi mean priv_trans_cpi mean coresi mean live_grandchild)






**********************
******* Table 2 ******
**********************
preserve
keep if year>=2006
xi: reg priv_trans_cpi nocar_treat_post treat_post nocar_treat nocar_post i.year_qtr i.eldest nocar age_head i.educ married male ownhouse [pw=weight], r
xi: reg priv_trans_cpi lesshs_treat_post treat_post lesshs_treat lesshs_post i.year_qtr i.eldest lesshs age_head married male ownhouse [pw=weight], r
restore




**********************
******* Table 3 ******
**********************
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest $controls (boap_cpi = treat_post) [pw=weight] if year>=2006, r 
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest (boap_cpi = treat_post) [pw=weight] if year>=2006, r 
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest treat_year $controls (boap_cpi = treat_post) [pw=weight] if year>=2006, r
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest $controls (boap_cpi = treat_post) [pw=weight] if year>=2006 & eldest>=55&eldest<=74 , r 
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest $controls (boap_cpi = treat_post) [pw=weight] if year>=2006 & eldest>=64&eldest<=65 , r 
xi: ivregress 2sls priv_trans_cpi i.year_qtr i.eldest $controls (boap_cpi = treat_post) [pw=weight], r 


***********************
******* Figure 1 ******
***********************

** panel A
preserve 
keep if year>=2006 & year<=2008 & treat==1
sort preinc 
xtile income10 = preinc [pw=weight], nq(100)
collapse (mean) priv_trans_cpi preinc, by(income10)
twoway scatter priv_trans_cpi preinc, mc(black) graphregion(color(white)) xtitle("Monthly Income excl. Priv Transfer (1,000KRW)") ///
ytitle("Monthly Private Transfer (1,000 KRW)") 
restore


** panel B
preserve 
keep if year>=2006 & year<=2008 & treat==1
gen share = priv_trans_cpi/income_cpi
sort income_cpi 
xtile income10 = income_cpi [pw=weight], nq(100)
collapse (mean) share income_cpi, by(income10)
twoway scatter share income_cpi, mc(black) graphregion(color(white)) xtitle("Monthly Income (1,000KRW)") ///
ytitle("Share of Monthly Private Transfer") 
restore



***********************
******* Figure 2 ******
***********************
preserve
collapse (mean) boap_cpi [pw=weight] if year>=2006, by(treat year)
twoway (scatter boap_cpi year if treat==1, mc(black)) (scatter boap_cpi year if treat==0, mfc(white) mlc(black)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Monthly BOAP Benefits (1,000 KRW)") xlabel(2006(1)2013)
restore



***********************
******* Figure 3 ******
***********************

** panel A
preserve
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore


** panel B
preserve
keep if eldest>=55 & eldest<=74
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-74)" 2 "Under65(55-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore


** panel C
preserve
keep if eldest>=64 & eldest<=65
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65)" 2 "Under65(64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore




***********************
******* Figure 4 ******
***********************

** panel A, no car is owned
preserve
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006 & nocar==1, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore

** panel A, car is owned
preserve
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006 & nocar==0, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore



** panel B, less than HS
preserve
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006 & lesshs==1, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore


** panel B, More than HS
preserve
collapse (mean) priv_trans_cpi [pw=weight] if year>=2006 & lesshs==0, by(treat year)
twoway (scatter priv_trans_cpi year if treat==1, mc(black)) (scatter priv_trans_cpi year if treat==0, mfc(white) mlc(black)) , ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Monthly Private Transfers (1,000 KRW)") xlabel(2006(1)2013)
restore





**********************************************************************************************************************************
******************************************************** Appendix Results ********************************************************
**********************************************************************************************************************************



***********************
******* Table A1 ******
***********************

** please use "results using KReIS" to replicate Table A1



***********************
******* Table A2 ******
***********************

** panel A
table treat [pw=weight] if year>=2006 & post==0, c(mean priv_trans_cpi mean coresi mean live_grandchild)
tab treat if year>=2006 & post==0

** panel B: please use "results using KLIPS to replicate panel B





***********************
******* Table A3 ******
***********************

preserve
keep if year>=2006

** panel A
xi: reg boap_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008, r 
xi: reg boap_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008 & (eldest>=55&eldest<=74), r
xi: reg boap_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008 & (eldest>=64&eldest<=65), r

** panel B
xi: reg priv_trans_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008, r 
xi: reg priv_trans_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008 & (eldest>=55&eldest<=74), r
xi: reg priv_trans_cpi treat_year year i.eldest $controls [pw=weight] if year<=2008 & (eldest>=64&eldest<=65), r
restore




***********************
******* Table A4 ******
***********************

preserve
keep if year>=2006

xi: reg age_head treat_post i.year i.eldest [pw=weight], r 
xi: reg high treat_post i.year i.eldest [pw=weight], r 
xi: reg married treat_post i.year i.eldest [pw=weight], r 
xi: reg male treat_post i.year i.eldest [pw=weight], r 
xi: reg numcar treat_post i.year i.eldest [pw=weight], r 
xi: reg ownhouse treat_post i.year i.eldest [pw=weight], r 
restore




************************
******* Figure A1 ******
************************

preserve
collapse (mean) age_head [pw=weight] if year>=2006, by(treat year)
twoway (scatter age_head year if treat==1, mc(black) yaxis(1)) (scatter age_head year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Age", axis(1)) ytitle("Age", axis(2)) xlabel(2006(1)2013)
restore
 

preserve
collapse (mean) high [pw=weight] if year>=2006, by(treat year)
twoway (scatter high year if treat==1, mc(black) yaxis(1)) (scatter high year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Pr(High School)", axis(1)) ytitle("Pr(High School)", axis(2)) ///
xlabel(2006(1)2013)
restore


preserve
collapse (mean) married [pw=weight] if year>=2006, by(treat year)
twoway (scatter married year if treat==1, mc(black) yaxis(1)) (scatter married year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Pr(Married)", axis(1)) ytitle("Pr(Married)", axis(2)) ///
xlabel(2006(1)2013)
restore


preserve
collapse (mean) male [pw=weight] if year>=2006, by(treat year)
twoway (scatter male year if treat==1, mc(black) yaxis(1)) (scatter male year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Pr(Male)", axis(1)) ytitle("Pr(Male)", axis(2)) ///
xlabel(2006(1)2013)
restore


preserve
collapse (mean) numcar [pw=weight] if year>=2006, by(treat year)
twoway (scatter numcar year if treat==1, mc(black) yaxis(1)) (scatter numcar year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Number of cars", axis(1)) ytitle("Number of cars", axis(2)) ///
 xlabel(2006(1)2013)
restore


preserve
collapse (mean) ownhouse [pw=weight] if year>=2006, by(treat year)
twoway (scatter ownhouse year if treat==1, mc(black) yaxis(1)) (scatter ownhouse year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)" )) xtitle("Year") ytitle("Pr(Own house)", axis(1)) ytitle("Pr(Own house)", axis(2)) ///
xlabel(2006(1)2013)
restore




************************
******* Figure A2 ******
************************

** panel A
preserve
collapse (mean) coresi [pw=weight] if year>=2006, by(treat year)
twoway (scatter coresi year if treat==1, mc(black) yaxis(1)) (scatter coresi year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ///
xlabel(2006(1)2013) ytitle("Prob of co-residence, 65-84", axis(1)) ytitle("Prob of co-residence, 45-64", axis(2)) ///
ylabel(.5(.05).65, axis(2)) ylabel(.25(.05).45, axis(1)) 
restore	


** panel B
preserve
collapse (mean) live_grandchild [pw=weight] if year>=2006, by(treat year)
twoway (scatter live_grandchild year if treat==1, mc(black) yaxis(1)) (scatter live_grandchild year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ///
 xlabel(2006(1)2013) ytitle("Prob of live alone or only with spouse, 65-74", axis(1)) ///
ytitle("Prob of live alone or only with spouse, 45-64", axis(2))
restore


** panels C and D: please use results using KLIPS for the replication




